package com.zs.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zs.pojo.*;
import com.zs.service.EmpService;
import com.zs.utils.PageResult;
import com.zs.utils.Result;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @描述
 * @创建人 wangyue
 * @创建时间2020/12/159:31
 */
@RestController
@RequestMapping("emp")
public class EmpController {

    @Reference
    private EmpService empService;

    @RequestMapping("pagelist")
    public PageResult<TEmp> pagelist(@RequestBody(required= false) TEmp tEmp
            , @RequestParam(defaultValue = "3") int pageSize,@RequestParam(defaultValue = "1") int pageNum){

        return empService.pagelist(tEmp,pageSize,pageNum);
    }
    @RequestMapping("getDePts")
    public List<TDemp> getDePts(){
        return empService.getDePts();
    }

    @RequestMapping("getZhiweis")
    public List<TZhiwei> getZhiweis(){
        return empService.getZhiweis();
    }

    @RequestMapping("qingjia")
    public Result qingjia(@RequestBody TQingjia tQingjia){
        try {
            empService.saveQj(tQingjia);
            return new Result(true,"");
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,e.getMessage());
        }
    }

    @RequestMapping("xzmx/{empid}")
    public Map<String,Object> xzmx(@PathVariable Integer empid){
        return empService.xzmx(empid);
    }
}